/**
 * 
 */
package com.bloomingstars.sqm;

import java.util.Calendar;

/**
 * @author Emmanuele Sordini
 */
public class SqmReadingRecord {

    private Calendar time;
    private double sqmReading;
    private double temperature;
    private double timeOfDay;
    
    public SqmReadingRecord(Calendar time, double sqmReading, double temperature) {
        super();
        this.time = time;
        this.sqmReading = sqmReading;
        this.temperature = temperature;
        calcTimeOfDay();
    }
        
    public Calendar getTime() {
        return time;
    }
    public void setTime(Calendar time) {
        this.time = time;
    }
    public double getSqmReading() {
        return sqmReading;
    }
    public void setSqmReading(double sqmReading) {
        this.sqmReading = sqmReading;
    }
    public double getTemperature() {
        return temperature;
    }
    public void setTemperature(double temperature) {
        this.temperature = temperature;
    }       
    
    public double getTimeOfDay() {
        return timeOfDay;        
    }
    
    public static int getValidFieldCount() {
        return 3;
    }
    
    private void calcTimeOfDay() {
        int h = time.get(Calendar.HOUR_OF_DAY);
        int m = time.get(Calendar.MINUTE);
        int s = time.get(Calendar.SECOND);
        
        timeOfDay = (double) h + (double)m / 60.0 + (double)s / 3600.0; 
    }
}
